﻿@model TestHttpModules.Models.ShoppingCart
@{
    ViewBag.Title = "Index";
}
@section Head{
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery-1.6.2.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")"></script>
    <script>
        function confirmFun() {
            $("input[name$=Quantity]").each(function (i, o) {
                if ($(this).val() == "") {
                    alert("不能为空");
                    return;
                }
            });
            return true;

        }
    </script>
}
<h2>
    Index</h2>
<img src="/error.gif" style="border: 1px solid" /><hr />
@Html.Raw(ViewBag.MSG)
@{
    List<test.EF.User_Info> linq2 = ViewBag.Linq as List<test.EF.User_Info>;

    linq2.Take(10).ToList().ForEach(i => Response.Write(i.UserName));
}
@using (Ajax.BeginForm("ProcessOrder", new AjaxOptions() { OnBegin = "confirmFun()" }))
{
    @Html.ValidationSummary(false)
for (int i = 0; i < Model.Count; i++)
{         
   
    <div>
        @Html.HiddenFor(m => m[i].Id)
        @Html.HiddenFor(m => m[i].Name)
        @Html.DisplayFor(m => m[i].Name):
        @Html.EditorFor(m => m[i].Quantity)
    </div>
   
}
   
    <input type="submit" value="提交订单" />
   
}
